#ifndef __display_h
#define __display_h



#define  bit1           0x01
#define  bit2           0x02
#define  bit3           0x04
#define  bit4           0x08
#define  bit5           0x10
#define  bit6           0x20
#define  bit7           0x40
#define  bit8           0x80

#define  cbit1           b1111_1110
#define  cbit2           b1111_1101
#define  cbit3           b1111_1011
#define  cbit4           b1111_0111
#define  cbit5           b1110_1111
#define  cbit6           b1101_1111
#define  cbit7           b1011_1111
#define  cbit8           b0111_1111

#define seta1	displayBuffer[0]|=bit5;
#define setb1	displayBuffer[0]|=bit4;
#define setc1	displayBuffer[0]|=bit3;
#define setd1	displayBuffer[0]|=bit2;
#define sete1	displayBuffer[0]|=bit1;
#define setf1	displayBuffer[0]|=bit7;
#define setg1	displayBuffer[0]|=bit8;
#define seth1	displayBuffer[1]|=bit1;
#define seti1	displayBuffer[1]|=bit2;
#define setj1	displayBuffer[1]|=bit3;
#define setk1	displayBuffer[1]|=bit4;
#define setl1	displayBuffer[1]|=bit5;
#define setm1	displayBuffer[1]|=bit6;
#define setn1	displayBuffer[1]|=bit7;

#define seta2	displayBuffer[2]|=bit5;
#define setb2	displayBuffer[2]|=bit4;
#define setc2	displayBuffer[2]|=bit3;
#define setd2	displayBuffer[2]|=bit2;
#define sete2	displayBuffer[2]|=bit1;
#define setf2	displayBuffer[2]|=bit7;
#define setg2	displayBuffer[2]|=bit8;
#define seth2	displayBuffer[3]|=bit1;
#define seti2	displayBuffer[3]|=bit2;
#define setj2	displayBuffer[3]|=bit3;
#define setk2	displayBuffer[3]|=bit4;
#define setl2	displayBuffer[3]|=bit5;
#define setm2	displayBuffer[3]|=bit6;
#define setn2	displayBuffer[3]|=bit7;

#define seta3	displayBuffer[6]|=bit5;
#define setb3	displayBuffer[6]|=bit4;
#define setc3	displayBuffer[6]|=bit3;
#define setd3	displayBuffer[6]|=bit2;
#define sete3	displayBuffer[6]|=bit1;
#define setf3	displayBuffer[6]|=bit7;
#define setg3	displayBuffer[6]|=bit8;
#define seth3	displayBuffer[7]|=bit1;
#define seti3	displayBuffer[7]|=bit2;
#define setj3	displayBuffer[7]|=bit3;
#define setk3	displayBuffer[7]|=bit4;
#define setl3	displayBuffer[7]|=bit5;
#define setm3	displayBuffer[7]|=bit6;
#define setn3	displayBuffer[7]|=bit7;

#define seta4	displayBuffer[4]|=bit5;
#define setb4	displayBuffer[4]|=bit4;
#define setc4	displayBuffer[4]|=bit3;
#define setd4	displayBuffer[4]|=bit2;
#define sete4	displayBuffer[4]|=bit1;
#define setf4	displayBuffer[4]|=bit7;
#define setg4	displayBuffer[4]|=bit8;
#define seth4	displayBuffer[5]|=bit1;
#define seti4	displayBuffer[5]|=bit2;
#define setj4	displayBuffer[5]|=bit3;
#define setk4	displayBuffer[5]|=bit4;
#define setl4	displayBuffer[5]|=bit5;
#define setm4	displayBuffer[5]|=bit6;
#define setn4	displayBuffer[5]|=bit7;

#define seta5	displayBuffer[8]|=bit5;
#define setb5	displayBuffer[8]|=bit4;
#define setc5	displayBuffer[8]|=bit3;
#define setd5	displayBuffer[8]|=bit2;
#define sete5	displayBuffer[8]|=bit1;
#define setf5	displayBuffer[8]|=bit7;
#define setg5	displayBuffer[8]|=bit8;
#define seth5	displayBuffer[9]|=bit1;
#define seti5	displayBuffer[9]|=bit2;
#define setj5	displayBuffer[9]|=bit3;
#define setk5	displayBuffer[9]|=bit4;
#define setl5	displayBuffer[9]|=bit5;
#define setm5	displayBuffer[9]|=bit6;
#define setn5	displayBuffer[9]|=bit7;

#define seta6	displayBuffer[10]|=bit5;
#define setb6	displayBuffer[10]|=bit4;
#define setc6	displayBuffer[10]|=bit3;
#define setd6	displayBuffer[10]|=bit2;
#define sete6	displayBuffer[10]|=bit1;
#define setf6	displayBuffer[10]|=bit7;
#define setg6	displayBuffer[10]|=bit8;
#define seth6	displayBuffer[11]|=bit1;
#define seti6	displayBuffer[11]|=bit2;
#define setj6	displayBuffer[11]|=bit3;
#define setk6	displayBuffer[11]|=bit4;
#define setl6	displayBuffer[11]|=bit5;
#define setm6	displayBuffer[11]|=bit6;
#define setn6	displayBuffer[11]|=bit7;

#define seta7	 displayBuffer[12]|=bit5;
#define setb7	 displayBuffer[12]|=bit4;
#define setc7	 displayBuffer[12]|=bit3;
#define setd7	 displayBuffer[12]|=bit2;
#define sete7	 displayBuffer[12]|=bit1;
#define setf7	 displayBuffer[12]|=bit7;
#define setg7	 displayBuffer[12]|=bit8;
#define seth7	 displayBuffer[13]|=bit1;
#define seti7	 displayBuffer[13]|=bit2;
#define setj7	 displayBuffer[13]|=bit3;
#define setk7	 displayBuffer[13]|=bit4;
#define setl7	 displayBuffer[13]|=bit5;
#define setm7	 displayBuffer[13]|=bit6;
#define setn7	 displayBuffer[13]|=bit7;

#define seta8	displayBuffer[14]|=bit5;
#define setb8	displayBuffer[14]|=bit4;
#define setc8	displayBuffer[14]|=bit3;
#define setd8	displayBuffer[14]|=bit2;
#define sete8	displayBuffer[14]|=bit1;
#define setf8	displayBuffer[14]|=bit7;
#define setg8	displayBuffer[14]|=bit8;
#define seth8	displayBuffer[15]|=bit1;
#define seti8	displayBuffer[15]|=bit2;
#define setj8	displayBuffer[15]|=bit3;
#define setk8	displayBuffer[15]|=bit4;
#define setl8	displayBuffer[15]|=bit5;
#define setm8	displayBuffer[15]|=bit6;
#define setn8	displayBuffer[15]|=bit7;










#define clra1	displayBuffer[0]&=cbit5;
#define clrb1	displayBuffer[0]&=cbit4;
#define clrc1	displayBuffer[0]&=cbit3;
#define clrd1	displayBuffer[0]&=cbit2;
#define clre1	displayBuffer[0]&=cbit1;
#define clrf1	displayBuffer[0]&=cbit7;
#define clrg1	displayBuffer[0]&=cbit8;
#define clrh1	displayBuffer[1]&=cbit1;
#define clri1	displayBuffer[1]&=cbit2;
#define clrj1	displayBuffer[1]&=cbit3;
#define clrk1	displayBuffer[1]&=cbit4;
#define clrl1	displayBuffer[1]&=cbit5;
#define clrm1	displayBuffer[1]&=cbit6;
#define clrn1	displayBuffer[1]&=cbit7;

#define clra2	displayBuffer[2]&=cbit5;
#define clrb2	displayBuffer[2]&=cbit4;
#define clrc2	displayBuffer[2]&=cbit3;
#define clrd2	displayBuffer[2]&=cbit2;
#define clre2	displayBuffer[2]&=cbit1;
#define clrf2	displayBuffer[2]&=cbit7;
#define clrg2	displayBuffer[2]&=cbit8;
#define clrh2	displayBuffer[3]&=cbit1;
#define clri2	displayBuffer[3]&=cbit2;
#define clrj2	displayBuffer[3]&=cbit3;
#define clrk2	displayBuffer[3]&=cbit4;
#define clrl2	displayBuffer[3]&=cbit5;
#define clrm2	displayBuffer[3]&=cbit6;
#define clrn2	displayBuffer[3]&=cbit7;

#define clra3	displayBuffer[6]&=cbit5;
#define clrb3	displayBuffer[6]&=cbit4;
#define clrc3	displayBuffer[6]&=cbit3;
#define clrd3	displayBuffer[6]&=cbit2;
#define clre3	displayBuffer[6]&=cbit1;
#define clrf3	displayBuffer[6]&=cbit7;
#define clrg3	displayBuffer[6]&=cbit8;
#define clrh3	displayBuffer[7]&=cbit1;
#define clri3	displayBuffer[7]&=cbit2;
#define clrj3	displayBuffer[7]&=cbit3;
#define clrk3	displayBuffer[7]&=cbit4;
#define clrl3	displayBuffer[7]&=cbit5;
#define clrm3	displayBuffer[7]&=cbit6;
#define clrn3	displayBuffer[7]&=cbit7;

#define clra4	displayBuffer[4]&=cbit5;
#define clrb4	displayBuffer[4]&=cbit4;
#define clrc4	displayBuffer[4]&=cbit3;
#define clrd4	displayBuffer[4]&=cbit2;
#define clre4	displayBuffer[4]&=cbit1;
#define clrf4	displayBuffer[4]&=cbit7;
#define clrg4	displayBuffer[4]&=cbit8;
#define clrh4	displayBuffer[5]&=cbit1;
#define clri4	displayBuffer[5]&=cbit2;
#define clrj4	displayBuffer[5]&=cbit3;
#define clrk4	displayBuffer[5]&=cbit4;
#define clrl4	displayBuffer[5]&=cbit5;
#define clrm4	displayBuffer[5]&=cbit6;
#define clrn4	displayBuffer[5]&=cbit7;

#define clra5	displayBuffer[8]&=cbit5;
#define clrb5	displayBuffer[8]&=cbit4;
#define clrc5	displayBuffer[8]&=cbit3;
#define clrd5	displayBuffer[8]&=cbit2;
#define clre5	displayBuffer[8]&=cbit1;
#define clrf5	displayBuffer[8]&=cbit7;
#define clrg5	displayBuffer[8]&=cbit8;
#define clrh5	displayBuffer[9]&=cbit1;
#define clri5	displayBuffer[9]&=cbit2;
#define clrj5	displayBuffer[9]&=cbit3;
#define clrk5	displayBuffer[9]&=cbit4;
#define clrl5	displayBuffer[9]&=cbit5;
#define clrm5	displayBuffer[9]&=cbit6;
#define clrn5	displayBuffer[9]&=cbit7;

#define clra6	displayBuffer[10]&=cbit5;
#define clrb6	displayBuffer[10]&=cbit4;
#define clrc6	displayBuffer[10]&=cbit3;
#define clrd6	displayBuffer[10]&=cbit2;
#define clre6	displayBuffer[10]&=cbit1;
#define clrf6	displayBuffer[10]&=cbit7;
#define clrg6	displayBuffer[10]&=cbit8;
#define clrh6	displayBuffer[11]&=cbit1;
#define clri6	displayBuffer[11]&=cbit2;
#define clrj6	displayBuffer[11]&=cbit3;
#define clrk6	displayBuffer[11]&=cbit4;
#define clrl6	displayBuffer[11]&=cbit5;
#define clrm6	displayBuffer[11]&=cbit6;
#define clrn6	displayBuffer[11]&=cbit7;

#define clra7	displayBuffer[12]&=cbit5;
#define clrb7	displayBuffer[12]&=cbit4;
#define clrc7	displayBuffer[12]&=cbit3;
#define clrd7	displayBuffer[12]&=cbit2;
#define clre7	displayBuffer[12]&=cbit1;
#define clrf7	displayBuffer[12]&=cbit7;
#define clrg7	displayBuffer[12]&=cbit8;
#define clrh7	displayBuffer[13]&=cbit1;
#define clri7	displayBuffer[13]&=cbit2;
#define clrj7	displayBuffer[13]&=cbit3;
#define clrk7	displayBuffer[13]&=cbit4;
#define clrl7	displayBuffer[13]&=cbit5;
#define clrm7	displayBuffer[13]&=cbit6;
#define clrn7	displayBuffer[13]&=cbit7;

#define clra8	displayBuffer[14]&=cbit5;
#define clrb8	displayBuffer[14]&=cbit4;
#define clrc8	displayBuffer[14]&=cbit3;
#define clrd8	displayBuffer[14]&=cbit2;
#define clre8	displayBuffer[14]&=cbit1;
#define clrf8	displayBuffer[14]&=cbit7;
#define clrg8	displayBuffer[14]&=cbit8;
#define clrh8	displayBuffer[15]&=cbit1;
#define clri8	displayBuffer[15]&=cbit2;
#define clrj8	displayBuffer[15]&=cbit3;
#define clrk8	displayBuffer[15]&=cbit4;
#define clrl8	displayBuffer[15]&=cbit5;
#define clrm8	displayBuffer[15]&=cbit6;
#define clrn8	displayBuffer[15]&=cbit7;














#define setLedUp 	 displayBuffer[2]|=bit6;
#define setLedDown	 displayBuffer[4]|=bit6;
#define setLedPower	 displayBuffer[6]|=bit6;
#define setLedMoShi	 displayBuffer[0]|=bit6;
//#define setLedYuYue   displayBuffer[9]|=bit7;


#define clrLedUp 	 displayBuffer[2]&=cbit6;
#define clrLedDown	 displayBuffer[4]&=cbit6;
#define clrLedPower	 displayBuffer[6]&=cbit6;
#define clrLedMoShi	 displayBuffer[0]&=cbit6;
//#define clrLedYuYue  displayBuffer[9]&=cbit7;


#define  set_led_1a  seta1;seth1;seti1;setj1;seta2;
#define  set_led_1b  seta2;setb2;setc2;setd2;
#define  set_led_1c  setd2;sete2;setf2;setg2;
#define  set_led_1d  setg1;setn1;setg8;setd8;setg2;
#define  set_led_1e  setg1;setf1;sete1;setd1;
#define  set_led_1f  setd1;setc1;setb1;seta1;
#define  set_led_1g  setd1;setk1;setl1;setm1;setd2;
#define  clr_led_1  clra1;clrh1;clri1;clrj1;clra2;\
                    clra2;clrb2;clrc2;clrd2;\
                    clrd2;clre2;clrf2;clrg2;\
                    clrg1;clrn1;clrg8;clrd8;clrg2;\
                    clrg1;clrf1;clre1;clrd1;\
                    clrd1;clrc1;clrb1;clra1;\
                    clrd1;clrk1;clrl1;clrm1;clrd2;


                                       
#define  set_led_2a    seth2;seta3;setb3;setc3;seth3;
#define  set_led_2b    seth3;seti3;setj3;setk3;
#define  set_led_2c    setk3;setl3;setm3;setn3;
#define  set_led_2d    setn2;setg3;setm8;setn8;setn3;
#define  set_led_2e    setn2;setm2;setl2;setk2;
#define  set_led_2f    setk2;setj2;seti2;seth2;
#define  set_led_2g    setk2;setd3;sete3;setf3;setk3;

#define clr_led_2      clrh2;clra3;clrb3;clrc3;clrh3;\
                       clrh3;clri3;clrj3;clrk3;\
                       clrk3;clrl3;clrm3;clrn3;\
                       clrn2;clrg3;clrm8;clrn8;clrn3;\
                       clrn2;clrm2;clrl2;clrk2;\
                       clrk2;clrj2;clri2;clrh2;\
                       clrk2;clrd3;clre3;clrf3;clrk3;



#define  set_led_3a    seta5;
#define  set_led_3b	   setb5;    
#define  set_led_3c    setc5;
#define  set_led_3d    setd5;
#define  set_led_3e    sete5;
#define  set_led_3f    setf5;
#define  set_led_3g    setg5;
#define clr_led_3   clra5;clrb5;  clrc5;clrd5;clre5;clrf5;clrg5;
                    
                    
#define  set_led_4a    seth5;
#define  set_led_4b	   seti5;    
#define  set_led_4c    setj5;
#define  set_led_4d    setk5;
#define  set_led_4e    setl5;
#define  set_led_4f    setm5;
#define  set_led_4g    setn5;                    
 #define clr_led_4       clrh5; clri5;    clrj5;  clrk5; clrl5;clrm5;  clrn5;  
                        
                       
#define  set_led_5a    seta6;
#define  set_led_5b	   setb6;     
#define  set_led_5c    setc6;
#define  set_led_5d    setd6;
#define  set_led_5e    sete6;
#define  set_led_5f    setf6;
#define  set_led_5g    setg6;                         
 #define clr_led_5   clra6;clrb6;  clrc6;clrd6;clre6;clrf6;clrg6;                       
                         
#define  set_led_6a    seth6;
#define  set_led_6b	   seti6;    
#define  set_led_6c    setj6;
#define  set_led_6d    setk6;
#define  set_led_6e    setl6;
#define  set_led_6f    setm6;
#define  set_led_6g    setn6;                         
 #define clr_led_6       clrh6; clri6;    clrj6;  clrk6; clrl6;clrm6;  clrn6; 
 
#define  set_led_7a    seta7;
#define  set_led_7b	   setb7;     
#define  set_led_7c    setc7;
#define  set_led_7d    setd7;
#define  set_led_7e    sete7;
#define  set_led_7f    setf7;
#define  set_led_7g    setg7;                      
   #define clr_led_7   clra7;clrb7;  clrc7;clrd7;clre7;clrf7;clrg7;    

#define  set_led_8a    seth7;
#define  set_led_8b	   seti7;    
#define  set_led_8c    setj7;
#define  set_led_8d    setk7;
#define  set_led_8e    setl7;
#define  set_led_8f    setm7;
#define  set_led_8g    setn7;                         
 #define clr_led_8       clrh7; clri7;    clrj7;  clrk7; clrl7;clrm7;  clrn7;  
 
 
 
 


//#define setPower1 	seta8;setb8;
//#define clrPower1	clra8;clrb8;

//#define setPower2	setc5;setd5;
//#define clrPower2	clrc5;clrd5;

//#define setPower3    sete5;setf5;
//#define clrPower3	 clre5;clrf5;




					
#define  setHuaSa1		seta4;setb4;			
#define  setHuaSa2		setc4;
#define  setHuaSa3		setd4;
#define  setHuaSa4		sete4;

#define  clrHuaSa1		clra4;clrb4;				
#define  clrHuaSa2		clrc4;
#define  clrHuaSa3		clrd4;
#define  clrHuaSa4		clre4;



#define setled12Flag     setf4;
#define clrled12Flag     clrf4;


 #define setNeiDanWenDu  seth4;seti4;
 #define clrNeiDanWenDu  clrh4;clri4;
 
 
 
//#define setError 		seth4;seti4;
//#define clrError  		clrh4;clri4;

#define setBaoWen		setj4;setg4;
#define clrBaoWen		clrj4;clrg4;

#define setJiaRe		seta8;setb8;
#define clrJiaRe		clra8;clrb8;

#define SetYuYueShiJian  setf8;setc8;
#define ClrYuYueShiJian	  clrf8;clrc8;

#define setClockFlag  sete8;

#define clrClockFlag  clre8;

	
#define setSheZhiWenDu  setk4;setl4;
#define clrSheZhiWenDu  clrk4;clrl4;



#define setled78Flag     setm4;
#define clrled78Flag     clrm4;       
                 
                   
                   
                  



                        
    

#ifdef __display_c

uint8_t    displayBuffer[16] ;

uint8_t    bdata    d_seg;
sbit    f_seg_a=d_seg^0;
sbit    f_seg_b=d_seg^1;
sbit    f_seg_c=d_seg^2;
sbit    f_seg_d=d_seg^3;
sbit    f_seg_e=d_seg^4;
sbit    f_seg_f=d_seg^5;
sbit    f_seg_g=d_seg^6;
sbit    f_seg_h=d_seg^7;

uint8_t curTempH;
uint8_t curTempL;
uint8_t setTempH;
uint8_t setTempL;
uint8_t gear;
uint8_t clockHourH;
uint8_t clockHourL;
uint8_t clockMinH;
uint8_t clockMinL;
uint8_t orderClockOpenHourH;
uint8_t orderClockOpenHourL;
uint8_t orderClockOpenMinH;
uint8_t orderClockOpenMinL;
bit bHuaSa;
uint8_t huaSaNum;
code const uint8_t displayFonts[10];
#else
extern bit bHuaSa;
extern uint8_t huaSaNum;
extern code const uint8_t displayFonts[10];
extern 	uint8_t curTempH;
extern uint8_t curTempL;
extern uint8_t setTempH;
extern uint8_t setTempL;
extern uint8_t gear;
extern uint8_t clockHourH;
extern uint8_t clockHourL;
extern uint8_t clockMinH;
extern uint8_t clockMinL;
extern uint8_t orderClockOpenHourH;
extern uint8_t orderClockOpenHourL;
extern uint8_t orderClockOpenMinH;
extern uint8_t orderClockOpenMinL;
extern uint8_t displayBuffer[16] ;

extern uint8_t    bdata    d_seg;

#endif

void		DisplayScan();
#endif
